<template>
  <view style="width: 100%;">
    <web-view :src="allUrl" :update-title="false"></web-view>
  </view>
</template>
 
<script>
  export default {
    data () {
      return {
        allUrl: '',
        viewerUrl: '/hybrid/html/web/viewer.html',
        pdfUrl: ''
      }
    },
    onLoad (e) {
	  if(e.pdfUrl)this.pdfUrl=decodeURIComponent(e.pdfUrl)
	  uni.setNavigationBarTitle({
	  	title: e.title
	  })
      let fileUrl = encodeURIComponent(this.pdfUrl) // encodeURIComponent 函数可把字符串作为 URI 组件进行编码。
      this.allUrl = this.viewerUrl + '?file=' + fileUrl
    }
  }
</script>
 
<style>
 
</style>